<html><head><title>2DDrawing.pb</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<pre><font face="Courier New, Courier, mono"size="2"><font color="#006666">;
</font><font color="#006666">; ------------------------------------------------------------
</font><font color="#006666">;
</font><font color="#006666">;   PureBasic - 2D Drawing example file
</font><font color="#006666">;
</font><font color="#006666">;    (c) 2005 - Fantaisie Software
</font><font color="#006666">;
</font><font color="#006666">; ------------------------------------------------------------
</font><font color="#006666">;
</font>
<b><font color="#006666">If</font></b> <font color="#006666">OpenWindow</font>(0, 100, 200, 300, 200, "2D Drawing Test")

  <font color="#006666">; Create an offscreen image, with a green circle in it.
</font>  <font color="#006666">; It will be displayed later
</font>  <font color="#006666">;
</font>  <b><font color="#006666">If</font></b> <font color="#006666">CreateImage</font>(0, 300, 200)
    <b><font color="#006666">If</font></b> <font color="#006666">StartDrawing</font>(<font color="#006666">ImageOutput</font>(0))
<font color="#006666">      Circle</font>(100,100,50,<font color="#006666">RGB</font>(0,0,255))  <font color="#006666">; a nice blue circle...
</font>
<font color="#006666">      Box</font>(150,20,20,20,<font color="#006666"> RGB</font>(0,255,0))  <font color="#006666">; and a green box
</font>      
<font color="#006666">      FrontColor</font>(<font color="#006666">RGB</font>(255,0,0)) <font color="#006666">; Finally, red lines..
</font>      <b><font color="#006666">For</font></b> k=0 <b><font color="#006666">To</font></b> 20
<font color="#006666">        LineXY</font>(10,10+k*8,200, 0)
      <b><font color="#006666">Next</font></b>
      
<font color="#006666">      DrawingMode</font>(<font color="#924B72">#PB_2DDrawing_Transparent</font>)
<font color="#006666">      BackColor</font>(<font color="#006666">RGB</font>(0,155,155)) <font color="#006666">; Change the text back and front colour
</font><font color="#006666">      FrontColor</font>(<font color="#006666">RGB</font>(255,255,255)) 
<font color="#006666">      DrawText</font>(10,50,"Hello, this is a test")

<font color="#006666">      StopDrawing</font>()
    <b><font color="#006666">EndIf</font></b>
  <b><font color="#006666">EndIf</font></b>

  <font color="#006666">; Create a gadget to display our nice image
</font>  <font color="#006666">;  
</font><font color="#006666">  ImageGadget</font>(0, 0, 0, 0, 0,<font color="#006666"> ImageID</font>(0))
  
  <font color="#006666">;
</font>  <font color="#006666">; This is the 'event loop'. All the user actions are processed here.
</font>  <font color="#006666">; It's very easy to understand: when an action occurs, the Event
</font>  <font color="#006666">; isn't 0 and we just have to see what have happened...
</font>  <font color="#006666">;
</font>  
  <b><font color="#006666">Repeat</font></b>
    Event =<font color="#006666"> WaitWindowEvent</font>() 
  <b><font color="#006666">Until</font></b> Event = <font color="#924B72">#PB_Event_CloseWindow</font>  <font color="#006666">; If the user has pressed on the window close button
</font>  
<b><font color="#006666">EndIf</font></b>

<b><font color="#006666">End</font></b>   <font color="#006666">; All the opened windows are closed automatically by PureBasic</font></font></pre>
</body></html>
